package com.zk.qqrobot.controller;

import com.zk.qqrobot.model.Reward;
import com.zk.qqrobot.service.RewardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/reward")
public class RewardController {
    @Autowired
    private RewardService rewardService;

    @GetMapping("/save")
    public String save(String nick,Double amount,String group){
        Reward reward = Reward.builder().nick(nick).rewardTotal(amount).build();
        return rewardService.save(reward,group);
    }

    @GetMapping("/top5")
    public String top5(String group){
        return rewardService.getTop5(group);
    }
}
